import os,sys

if len(sys.argv)<2:
    print 'Usage: python import_bed.py importList'
    exit(1)

fi=open(sys.argv[1],'r')
i=0
for line in fi:
    line=line.strip()
    if len(line)<1:
    	continue
    temp=line.split('\t')
#    if 'bed 6' in temp[1] or 'bed 12' in temp[1]:
#    	continue
    if 'bed 10' not in temp[1]:
    	continue
    i+=1
    n=temp[1].split(' ')[1]
    cmd='py ../gis-basic-storage/console/bcs.py load mongodb_table -F bed'+n+':bed'+n+' --tags=\'assembly=hg19;UCSC_name='+temp[0]+'\' -i ./bed/'+temp[0]+'.bed'
    #print cmd
    os.system(cmd)
    #if i>5:
    #	break
fi.close()
